﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BCService.Common.RedisClear
{
    /// <summary>
    /// Redis缓存清理
    /// </summary>
    public interface IRedisClearService
    {
        /// <summary>
        /// 清空 Redis 服务器的数据(删除数据库的所有 key )。
        /// 不填写databasesNo则清空所有数据库
        /// 此命令从不失败。
        /// <paramref name="databasesNo">数据库编号</paramref>
        /// </summary>
        void FlushAsync(int? databasesNo);
        /// <summary>
        /// 返回当前数据库的 key 的数量。
        /// <paramref name="databaseNo">数据库编号</paramref>
        /// </summary>
        long Size(int databaseNo = 0);
        /// <summary>
        /// 获取Redis服务器信息
        /// </summary>
        /// <param name="section">节点信息</param>
        /// <returns></returns>
        IGrouping<string, KeyValuePair<string, string>>[] Info(string section);
        /// <summary>
        /// 获取redis服务器原始信息
        /// </summary>
        /// <param name="section">节点名称</param>
        /// <returns></returns>
        string InfoRaw(string section);
        /// <summary>
        /// 清理员工信息
        /// </summary>
        /// <param name="adminId">员工Id</param>
        void ClearAdminInfo(long adminId);
        /// <summary>
        /// 清理用户信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        void ClearUser(long userId);
        /// <summary>
        /// 清理订单缓存
        /// </summary>
        /// <param name="orderId">订单Id</param>
        /// <param name="orderNo">订单编号</param>
        void RemoveOrderCatch(long orderId, string orderNo);
    }
}
